package com.csx.governance.traffic.route.model.swimlane;

import com.csx.governance.traffic.core.Weighted;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;

import java.util.ArrayList;

/**
 * 泳道路由策略
 * @author cuisongxu
 * @date 2023/2/25 19:06
 */
@EqualsAndHashCode(callSuper = true)
@Data
public class SwimLaneStrategy extends ArrayList<SwimLaneStrategy.SwimLaneSubStrategy> {

    @NoArgsConstructor
    @Data
    public static class SwimLaneSubStrategy implements Weighted {
        /**
         * 泳道ID
         */
        private String swimLaneId;

        /**
         * 权重值
         */
        private int weight;

        @Override
        public int getWeight() {
            return weight;
        }

        @Override
        public String toString() {
            return "SwimLane{" + swimLaneId + "=" + weight + "%}";
        }
    }

}
